package com.vincent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.jms.JMSException;

import static com.vincent.ConsumerTest.receiveMQ;

/**
 * Created by vincent on 2018/7/29.
 */
public class ConsumerReceiveRunner implements Runnable{
   private final static Logger logger = LoggerFactory.getLogger(ConsumerRunner.class);
    @Override
    public void run() {
        while (true) {

            String s = null;
            try {
                logger.info("**********************");
                s = ConsumerTest.receiveMQ("test-queue");
                logger.info("收到消息:" + s);
                Thread.sleep(1000L);
            } catch (JMSException e) {
                e.printStackTrace();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
